local yingshe = fk.CreateSkill {
  name = "th_yingshe",
  max_turn_use_time = 1,
}

yingshe:addEffect(fk.CardUseFinished, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(yingshe.name) and target and target:isAlive() and target ~= player and data.card and data.card.is_damage_card and data.tos and
    table.find(data.tos, function(to) return to == player end)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local froms = table.filter(room:getOtherPlayers(target, false), function(p)
      return p:inMyAttackRange(target)
    end)
    if #froms < 1 then return end
    local players = room:askToChoosePlayers(player, {
      targets = froms,
      min_num = 1,
      max_num = 1,
      prompt = "#th_yingshe-invoke::" .. target.id,
      skill_name = yingshe.name
    })
    if #players > 0 then
      event:setCostData(self, { tos = players })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local dat = event:getCostData(self)
    room:useVirtualCard("fire__slash", nil, dat.tos[1], target, yingshe.name)
  end
}, { check_skill_limit = true })

Fk:loadTranslationTable{
  ["th_yingshe"] = "影蛇",
  [":th_yingshe"] = "每回合限一次，其他角色使用指定你的伤害牌后，你可以令一名攻击范围含有其的角色视为对其使用一张火【杀】。",

  ["#th_yingshe-invoke"] = "影蛇：你可以令一名攻击范围含有 %dest 的角色视为对 %dest 使用一张火【杀】",
}

return yingshe